<style type="text/css">
  .cls_plan .sear_dl .def {
    background: #ff3c3c !important;
    border: none !important;
    color: #fff !important;
    padding-left: 4px;
    padding-right: 4px;
}
</style>
<?php
  $get_order = $this->get('order');
  $get_max_price = $this->get('max_price');
?>
<div class="main_content w1200">
  <!--今日推荐-->
  <div class="recom">
    <ul class="wrapper">
        <?php foreach($rec_goods_list as $k=>$v):?>
      <li>
        <a href="<?=url('goods/detail',['id'=>$v['id']])?>"><img src="<?=$v['pic']?>"></a>
        <div class="info">
          <p class="name"><a href="<?=url('goods/detail',['id'=>$v['id']])?>"><?=$v['title']?></a></p>
          <p class="price">￥<?=$v["price"]?></p>
        </div>
      </li>
        <?php endforeach;?>
    </ul>
  </div>
  <!--今日推荐-->
  <!--猜你喜欢-->
  <?php include_once __DIR__.'/../inc/footpoint.html';?>
  <!--猜你喜欢-->
  <div class="cls_plan fr">
    <!--产品筛选-->
    <div class="cls_plan_sear">
      <!--价格筛选-->
      <dl class="sear_dl">
        <dd style="width: 100%;">
          <a onclick="search_goods('price','','')" href="javascript:;" class="<?php if($get_max_price===''):?>def<?php endif;?>">全部</a>
          <a onclick="search_goods('price',0,100)" href="javascript:;" class="<?php if($get_max_price==100):?>def<?php endif;?>">0-100</a>
          <a onclick="search_goods('price',100,250)" href="javascript:;" class="<?php if($get_max_price==250):?>def<?php endif;?>">100-250</a>
          <a onclick="search_goods('price',250,500)" href="javascript:;" class="<?php if($get_max_price==500):?>def<?php endif;?>">250-500</a>
          <a onclick="search_goods('price',500,1000)" href="javascript:;" class="<?php if($get_max_price==1000):?>def<?php endif;?>">500-1000</a>
          <a onclick="search_goods('price',1000,10000)" href="javascript:;" class="<?php if($get_max_price==10000):?>def<?php endif;?>">1000-10000</a>
          <a onclick="search_goods('price',10000,100000)" href="javascript:;" class="<?php if($get_max_price==100000):?>def<?php endif;?>">10000-100000</a>
          <div class="writeLine">
            <form name="PriceForm" id="priceForm" action="<?=url('goods/lists')?>">
              <input name="min_price" type="text" placeholder="0.00" value="">
              <span class="str">-</span>
              <input name="max_price" type="text" placeholder="0.00" value="">
              <a onclick="javascript:$('#priceForm').submit()" class="confirm">确定</a>
            </form>
          </div>
        </dd>
      </dl>
      <!--价格筛选-->
    </div>
    <!--产品筛选-->
    <!--综合排序-->
    <div class="cls_plan_sort">
      <div class="sort fl">
        <a href="javascript:;" onclick="search_goods('order',1)" class="<?php if($get_order==1):?>def<?php endif;?>">综合</a>
        <a href="javascript:;" onclick="search_goods('order',2)" class="<?php if($get_order==2):?>def<?php endif;?>">销量</a>
        <a href="javascript:;" onclick="search_goods('order',3)" class="<?php if($get_order==3):?>def<?php endif;?>">人气</a>
        <a href="javascript:;" onclick="search_goods('order',4)" class="<?php if($get_order==4):?>def<?php endif;?>">价格</a>
      </div>
      <div class="qie fr"><span><i>1</i>/1</span></div>
    </div>
    <!--综合排序-->
    <!--产品列表-->
    <div class="cls_plan_list">
    <?php if($goods_list):?>
      <ul class="wrapper">
        <?php foreach($goods_list as $k=>$v):?>
        <li>
          <div class="border_out">
            <div class="img"><a href="<?=url('goods/detail',['id'=>$v['id']])?>"><img src="<?=$v['pic']?>"></a></div>
            <div class="info">
              <p class="price"><em><i>￥</i><?=$v['price']?></em></p>
              <p class="name"><a href="<?=url('goods/detail',['id'=>$v['id']])?>"><?=$v['title']?></a></p>
              <p class="eval"><span class="el">销量：<i><?=$v['sales_volume']?>(件)</i></span></p>
              <p class="stor"></p>
            </div>
          </div>
        </li>
        <?php endforeach;?>
      </ul>
      <!--分页-->
      <div class="plan_pager fr">
        <div class="pageing" id='page'>
        </div>
      </div>
      <!--分页-->
    <?php else:?>
        <p class="nullPorm">暂无商品，去逛逛其他地方吧！</p>
    <?php endif;?>
    </div>
    <!--产品列表-->
  </div>
  <div class="clear"></div>
</div>
<script type="text/javascript">
    //搜索赛选
    function search_goods(type,value1='',value2=''){
        var o = GetRequest();
        if(type=="price"){
           o.min_price = value1;
           o.max_price = value2;
        }
        if(type=="order"){
            o.order = value1;
        }
        o.url  = '/goods/lists';
        window.location.href = createUrl(o);
    }

//分页
layui.use(['laypage'], function(){
    var laypage = layui.laypage;
    laypage.render({
      elem: 'page'
      ,count:<?=$page_count?>
      ,curr:<?=$page?>
      ,limit:20
      ,jump: function(obj,first){
        //首次不执行
        if(!first){
            var o = GetRequest();
                o.page = obj.curr;
                o.url  = '/goods/lists';
            window.location.href = createUrl(o);
        }
      }
    });
});
</script>
